package com.lagou.service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lagou.domain.Article;
import com.lagou.mapper.ArticleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    public PageInfo findAll(int pageNo, int pageSize) {
        PageHelper.startPage(pageNo,pageSize);
        List<Article> all = articleMapper.findAll();
        PageInfo pageInfo = new PageInfo(all);
        return pageInfo;
    }
}
